<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>

    <script>
        //解析字符串，来执行
        /*var s = 'var a=100'
        eval(s)
        console.log(a)  //100*/


        //let 使用，定义变量，方法

        //var 声明的变量往往是越域的
        //let 声明的变量有严格的作用域
        /*{
            var a = 1;
            let b = 2;
        }
        console.log(a)
        console.log(b)*/
        //-------------------------------------

        //var 可以声明多次
        //let 只能声明1次
        /*var a = 1
        var a = 2
        let b = 3
        //let b = 4

        console.log(a)
        console.log(b)*/

        //-----------------------------------

        //var 会变量提升
        //let 不存在提升
        console.log(a)
        var a = 1;
        console.log(b)
        let b = 2;







    </script>

</head>

<body>

</body>
</html>
